package com.survivor.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.survivor.example.Lessone10Activity;
import com.survivor.example.Lessone11Activity;
import com.survivor.example.Lessone12Activity;
import com.survivor.example.Lessone13Activity;
import com.survivor.example.Lessone16Activity;
import com.survivor.example.Lessone16Rendder;
import com.survivor.example.Lessone9Activity;
import com.survivor.opengl.R;

import android.app.Activity;
import android.content.Context;
import android.text.NoCopySpan.Concrete;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MyAdapter extends BaseAdapter{
	
	private static final String[] TITLES = 
	{
		"Lessone 9",
		"Lessone 10",
		"Lessone 11",
		"Lessone 12",
		"Lessone 13",
		"Lessone 16"
	};
	
	private static final Class[] ACTIVITY_LIST =
	{
			Lessone9Activity.class,
			Lessone10Activity.class,
			Lessone11Activity.class,
			Lessone12Activity.class,
			Lessone13Activity.class,
			Lessone16Activity.class
	};
	
//	private Map<String, Class> map = new HashMap<String, Class>();
	private List<Map> list = new ArrayList<Map>();
	
	private LayoutInflater mInflater;
	
	
	public MyAdapter(Context context) {
		// TODO Auto-generated constructor stub
		mInflater = LayoutInflater.from(context);
		for(int i = 0; i < TITLES.length; i++)
		{
			Map map = new HashMap();
			map.put("title", TITLES[i]);
			map.put("class", ACTIVITY_LIST[i]);
			list.add(map);
		}
			
	}


	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}


	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}


	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}


	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		
		convertView = mInflater.inflate(R.layout.list_item, null);
		TextView  title = (TextView) convertView.findViewById(R.id.title);
		title.setText(list.get(position).get("title").toString());
		return convertView;
	}
	
	

}
